import { Component ,ViewChild} from '@angular/core';
import { Platform } from 'ionic-angular';
import { StatusBar } from '@ionic-native/status-bar';
import { SplashScreen } from '@ionic-native/splash-screen';
import { CacheimgserviceProvider } from "../providers/cacheimgservice/cacheimgservice";
import { TabsPage } from '../pages/tabs/tabs';
import {SettingsProvider} from '../providers/settings/settings'
import { JPush } from '@jiguang-ionic/jpush';
import {JpushUtilProvider} from '../providers/jpush-util/jpush-util'

@Component({
  templateUrl: 'app.html'
})
export class MyApp {
 
  rootPage:any = TabsPage;
  selectedTheme: string;

  constructor(platform: Platform, 
              statusBar: StatusBar, 
              splashScreen: SplashScreen,
              private settings: SettingsProvider,
              imgcacheService: CacheimgserviceProvider,
              private jpushUtil:JpushUtilProvider,
              jpush:JPush ) {
    this.settings.getActiveTheme().subscribe(val=>this.selectedTheme = val)
    platform.ready().then(() => {
      // Okay, so the platform is ready and our plugins are available.
      // Here you can do any higher level native things you might need.
      statusBar.styleDefault();
      splashScreen.hide();
      imgcacheService.initImgCache();

      jpush.init();
      jpush.setDebugMode(true);

      /*消息推送配置**/
      this.jpushUtil.initPush();//监听初始化
      this.jpushUtil.setAlias("ionic");    //设置别名

    });
  }
}
